|
|
|
CAUTION
|
|
|
|
|
Remember, VBScript does not run in Netscape Navigator, so you may want to perform validation tasks on the server. |
|
|
|
|
|
|
|
|
|
|
In Listing 30.3, many of the form tasks are handled in VBScript instead of HTML. For example, the ACTION and METHOD parameters are left out of the form declaration. No submit button was provided because the form was submitted from VBScript code. Also, notice the hidden form field, which stores a value that the user did not enter. A sample run of the page in Listing 30.3 is shown in Figure 30.8. |
|
|
|
|
|
|
|
|
Figure 30.8
VBScript validates form data before
submitting it to the Web server. |
|
|
|
|
|
|
|
|
In addition to creating objects with the CreateObject method, you can embed objects in your Web page by using the <OBJECT> tag. The <OBJECT> tag allows you to place ActiveX controls in a Web page. Your VBScript code can then access these objects, as in the list box example here: |
|
|
|
|
|
|
|
|
<HTML>
<BODY>
<OBJECT id=lstmain classid=clsid:8BD21D20-EC42-11CE-9E0D-00AA006002F3
width=152 height=164>
<PARAM name=ScrollBars value=3>
<PARAM name=DisplayStyle value=2>
</OBJECT>
<SCRIPT Language = "VBScript">
<!--
Dim i
For i = 1 to 10
lstMain.AddItem "Item " & i
Next
Sub lstMain_Click()
Msgbox "You Clicked " & lstMain.List(lstMain.ListIndex)
End Sub |
|
|
|
|
|